home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
GameKit
/
Examples
/
PacMan
/
PacManInfoController.m
< prev
next >
Wrap
Text File
|
1995-06-12
|
1KB
|
38 lines
#import <soundkit/Sound.h>
#import "PacManInfoController.h"
@implementation PacManInfoController
// Pressing the invisible button in the info panel starts the PacMan music.
// When this happens, the game's sounds are temporarily turned off.
// We then turn them back on when the sound finishes playing. If a new
// game is started while we're playing, then we abort the sound so that
// the game's effects can come back.
- playSound:sender
{ // load sound if first time playing...
if (!sound) sound = [[[Sound alloc]
initFromSection:"InfoMusic.snd"] setDelegate:self];
[[[NXApp delegate] soundPlayer] turnOn:NO]; // temp. turn off sound player
[sound play];
return self;
}
- stopSound:sender
{ // will stop the sound (if playing)
[sound stop];
// be sure to turn sound player back on
[[[NXApp delegate] soundPlayer]
turnOn:[[[NXApp delegate] preferencesBrain] effects]];
return self;
}
- didPlay:sender
{ // turn sound player back on
[[[NXApp delegate] soundPlayer]
turnOn:[[[NXApp delegate] preferencesBrain] effects]];
return self;
}
@end